Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With --isolatedModules, --declaration emit is now allowed and builder handles it for incremental compilation #33380

Merged
merged 3 commits into from
Sep 19, 2019

Conversation

sheetalkamat
Copy link
Member

Enables .d.ts emit with --isolatedModules
Builder handles the emit so that it can cache semantic diagnostics as well as do d.ts emit

Fixes #29490 and #32294

@sheetalkamat sheetalkamat changed the base branch from dtsOnlyEmit to master September 11, 2019 20:11
@pleerock
Copy link

now we'll be able to use react in monorepos

@Bnaya
Copy link

Bnaya commented Sep 18, 2019

Will it make possible to use isolatedModules and composite ?

@sheetalkamat
Copy link
Member Author

Ping for review

@sheetalkamat sheetalkamat merged commit 7f004ad into master Sep 19, 2019
@sheetalkamat sheetalkamat deleted the isolatedModules branch September 19, 2019 23:20
@pleerock
Copy link

pleerock commented Oct 1, 2019

@sheetalkamat since its merged into the master I guess it should be available in 3.7.0-dev.20191001 ? I just installed this version and still have this Option 'declaration' cannot be specified with option 'isolatedModules'. error.

@sheetalkamat
Copy link
Member Author

@pleerock Please open a issue with steps to reproduce the issue. I don't see the issue with typescript@next on simple project

c:\temp\test2>node node_modules\typescript\lib\tsc.js -v
Version 3.7.0-dev.20191001

c:\temp\test2>node node_modules\typescript\lib\tsc.js  --listFiles --listEmittedFiles
TSFILE: c:/temp/test2/a.js
TSFILE: c:/temp/test2/a.d.ts
c:/temp/test2/node_modules/typescript/lib/lib.d.ts
c:/temp/test2/node_modules/typescript/lib/lib.es5.d.ts
c:/temp/test2/node_modules/typescript/lib/lib.dom.d.ts
c:/temp/test2/node_modules/typescript/lib/lib.webworker.importscripts.d.ts
c:/temp/test2/node_modules/typescript/lib/lib.scripthost.d.ts
c:/temp/test2/a.ts

c:\temp\test2>type tsconfig.json
{
    "compilerOptions": {
        "isolatedModules": true,
        "declaration": true
    }
}
c:\temp\test2>

@pleerock
Copy link

pleerock commented Oct 1, 2019

@sheetalkamat you should try it in a composite project. reproduction: https://github.com/pleerock/learn-a

@sheetalkamat
Copy link
Member Author

@pleerock Still no repro

c:\temp\learn-a>npm i

> command-join@2.0.1 postinstall c:\temp\learn-a\node_modules\command-join
> npx -p @seangenabe/tnx tnx || exit 0

npx: installed 1 in 2.048s

    Thanks for installing command-join!

    If you like this package, be sure to star its repo,
    and please consider donating:

        https://seangenabe.netlify.com/donate

npm WARN learn-a No repository field.
npm WARN learn-a No license field.

added 318 packages from 172 contributors and audited 1394 packages in 15.153s
found 0 vulnerabilities


c:\temp\learn-a>lerna bootstrap
lerna notice cli v3.13.1
lerna info Bootstrapping 3 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna success Bootstrapped 3 packages

c:\temp\learn-a>node node_modules\typescript\lib\tsc.js -v
Version 3.7.0-dev.20191001

c:\temp\learn-a>node node_modules\typescript\lib\tsc.js -b -v packages --listFiles --listEmittedFiles
[11:31:06 AM] Projects in this build:
    * packages/pkg1/tsconfig.json
    * packages/pkg2/tsconfig.json
    * packages/pkg3/tsconfig.json
    * packages/tsconfig.json

[11:31:06 AM] Project 'packages/pkg1/tsconfig.json' is out of date because output file 'packages/pkg1/lib/foo.js' does not exist

[11:31:06 AM] Building project 'c:/temp/learn-a/packages/pkg1/tsconfig.json'...

TSFILE: c:/temp/learn-a/packages/pkg1/lib/foo.js.map
TSFILE: c:/temp/learn-a/packages/pkg1/lib/foo.js
TSFILE: c:/temp/learn-a/packages/pkg1/lib/foo.d.ts.map
TSFILE: c:/temp/learn-a/packages/pkg1/lib/foo.d.ts
TSFILE: c:/temp/learn-a/packages/pkg1/lib/index.js.map
TSFILE: c:/temp/learn-a/packages/pkg1/lib/index.js
TSFILE: c:/temp/learn-a/packages/pkg1/lib/index.d.ts.map
TSFILE: c:/temp/learn-a/packages/pkg1/lib/index.d.ts
TSFILE: c:/temp/learn-a/packages/pkg1/tsconfig.tsbuildinfo
c:/temp/learn-a/node_modules/typescript/lib/lib.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.es5.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.dom.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.webworker.importscripts.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.scripthost.d.ts
c:/temp/learn-a/packages/pkg1/src/foo.ts
c:/temp/learn-a/packages/pkg1/src/index.ts
[11:31:08 AM] Project 'packages/pkg2/tsconfig.json' is out of date because output file 'packages/pkg2/lib/index.js' does not exist

[11:31:08 AM] Building project 'c:/temp/learn-a/packages/pkg2/tsconfig.json'...

TSFILE: c:/temp/learn-a/packages/pkg2/lib/index.js.map
TSFILE: c:/temp/learn-a/packages/pkg2/lib/index.js
TSFILE: c:/temp/learn-a/packages/pkg2/lib/index.d.ts.map
TSFILE: c:/temp/learn-a/packages/pkg2/lib/index.d.ts
TSFILE: c:/temp/learn-a/packages/pkg2/tsconfig.tsbuildinfo
c:/temp/learn-a/node_modules/typescript/lib/lib.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.es5.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.dom.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.webworker.importscripts.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.scripthost.d.ts
c:/temp/learn-a/packages/pkg1/lib/foo.d.ts
c:/temp/learn-a/packages/pkg1/lib/index.d.ts
c:/temp/learn-a/packages/pkg2/src/index.ts
[11:31:08 AM] Project 'packages/pkg3/tsconfig.json' is out of date because output file 'packages/pkg3/lib/index.js' does not exist

[11:31:08 AM] Building project 'c:/temp/learn-a/packages/pkg3/tsconfig.json'...

TSFILE: c:/temp/learn-a/packages/pkg3/lib/index.js.map
TSFILE: c:/temp/learn-a/packages/pkg3/lib/index.js
TSFILE: c:/temp/learn-a/packages/pkg3/lib/index.d.ts.map
TSFILE: c:/temp/learn-a/packages/pkg3/lib/index.d.ts
TSFILE: c:/temp/learn-a/packages/pkg3/tsconfig.tsbuildinfo
c:/temp/learn-a/node_modules/typescript/lib/lib.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.es5.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.dom.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.webworker.importscripts.d.ts
c:/temp/learn-a/node_modules/typescript/lib/lib.scripthost.d.ts
c:/temp/learn-a/packages/pkg1/lib/foo.d.ts
c:/temp/learn-a/packages/pkg1/lib/index.d.ts
c:/temp/learn-a/packages/pkg2/lib/index.d.ts
c:/temp/learn-a/packages/pkg3/src/index.ts

c:\temp\learn-a>type packages\pkg3\tsconfig.json
{
  "extends": "../tsconfig.settings.json",
  "compilerOptions": {
    "outDir": "lib",
    "rootDir": "src",
    "isolatedModules": true
  },
  "references": [
    { "path": "../pkg1" },
    { "path": "../pkg2" }
  ]
}
c:\temp\learn-a>

@pleerock
Copy link

pleerock commented Oct 2, 2019

@sheetalkamat I apologize, my bad here. Thought I was using local version when running tsc instead of older global one, but I was wrong 🤦‍♂ Say no to globally installed modules 🙅‍♂

Everything is working on latest beta, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow emitDeclaration and isolatedModules together
4 participants